1. Field of the Invention
The present invention relates to a coded data length detection apparatus and method suitable for use when detecting suitable quantization coefficients for making an amount of coded data a desired value in a coding scheme performing quantization of the Joint Photographic Experts Group (JPEG) etc. and to an image coding apparatus for coding the image data by using the detected quantization coefficients.
2. Description of the Related Art
FIG. 1 is a view of a standard circuit of the related art used when compressing and coding an image in a scheme using the JPEG and other discrete cosine transform (DCT).
In a compression and coding circuit 90 shown in FIG. 1, an input original data is processed DCT by a DCT unit 91 and an obtained DCT value is applied to a quantizer 92.
The quantizer 92 quantizes DCT coefficients input from the DCT unit 91 based on final quantization coefficients finally determined by multiplying basic quantization coefficients output from a quantization table 93 input from a multiplier 94 with variable for adjusting the final quantization coefficients, that is, “scale factor”, and outputs the data of the quantized result to a Huffman encoder 95.
The Huffman encoder 95 performs Huffman coding based on Huffman coding coefficients in a Huffman coding table 96 and outputs the bit stream data of the coded result as a compressed image result.
Also, the data length of the compressed data is counted by a compressed data length counter 97.
Note that the data length of the compressed data changes in accordance with the variables given to the scale factors or the basic quantization coefficients in the quantization table. Accordingly, when the compressed data length has to be made a certain size, for example, in the case of making the data length a fixed length, the scale factors or the basic quantization coefficients are adjusted.
When making the compressed data a fixed length in the compression and coding circuit 90 of the related art configured in this way, the compressed data length is obtained by compressing the data several times while changing the scale factors or the basic quantization coefficients in the quantization table and determining the scale factors or final quantization coefficients most suitable for attaining a fixed length based on the result.
Note, when the length of the compressed image data is long, the coded data is accurate, but a total data of the compressed image data becomes large. If there is limitation on a memory capacity of a memory for storing the compressed image data, it is needed to find a suitable data length on the compressed image data by which a total compressed image data is storable and suitable high accuracy compressed image data can be obtained. Similarly, when transferring the compressed image data on a transfer line in a limit of a transfer speed thereof with suitable high accuracy compressed image data, it is needed to find a suitable data length.
In the compression and coding circuit 90 of the related art explained above, however, only one compressed data length is obtained by one compression. When n number of compressed data lengths are necessary for determining the scale factors or quantization table most suitable for attaining a fixed data length, it was necessary to repeat the compression processing n number of times. As a result, it suffers from the disadvantage that the processing time required for attaining a fixed length became long.
Also, to make the processing time shorter, when obtaining the scale factors most suitable for attaining a fixed length, the method is sometimes adopted of not compressing the entire original image, but compressing only a part of the original image and predicting the most suitable scale factors for attaining a fixed length based on the result.
However, frequency components of the part of the original image used for the prediction and of the entire original image, that is, the complexities, are not always same. There was therefore the disadvantage that the compressed data length could not be predicted at a high accuracy and it became impossible to attain a suitable fixed length.